Dynomotion

Group: DynoMotion Message: 12987 From: mp.3333 Date: 3/26/2016
Subject: Buffer Underflow Error

Hi Tom, the KFLOP is running well for most of my G code files.  But when trying to run large files (12K lines) with arcs made up of small segments, I get random buffer underflow errors.  I am running latest version - 4.33 and using the Dynomotion VB.net app but customized for my machine.  The errors do not occur when running this same G code file from the KMotionCNC app.


After running a few minutes, the vb.net screen updates appear to slow until the error is generated.  I use the same 100msec timer to update the screen.  Could this rate be a problem with script commands?  Any thoughts on solution?


Here are defaults:


_Controller.CoordMotion.MotionParams.BreakAngle = 40


_Controller.CoordMotion.MotionParams.CollinearTolerance = 0.001


_Controller.CoordMotion.MotionParams.CornerTolerance = 0.001


_Controller.CoordMotion.MotionParams.FacetAngle = 1.0


_Controller.CoordMotion.MotionParams.MaxLinearLength = 100


_Controller.CoordMotion.MotionParams.TPLookahead = 3.0


Thanks, Mike



Group: DynoMotion Message: 12988 From: mp.3333 Date: 3/26/2016
Subject: Re: Buffer Underflow Error

Hi Tom, more info...


Changed update timer to 1 sec and it finished g code file without error but was 40% slower than running it on KMotionCNC.  I ran it a second time and an error was generated near the end.


Thanks, Mike

Group: DynoMotion Message: 12990 From: TKSOFT Date: 3/26/2016
Subject: Re: Buffer Underflow Error
Hi Mike,

There is an internal Thread created to run the GCode Interpreter and execute the code. This Thread also downloads data to KFLOP and executes callbacks to your App for lines and arcs created. Also status update callbacks. What are you doing in those callbacks? If you are not returning from those callbacks quickly you will slow down the other functions that the GCode Interpreter needs to do. For example you shouldn't update your GUI from within those callbacks.

Otherwise maybe you have a bug where you keep hooking in callbacks repeatedly? Or a memory leak?

Maybe try deleting functionality in your code to see if you can determine which section of your code causes the problem.

The latest Test Version 4.34a works with VS2015 and may provide better diagnostic debugging clues/warnings than earlier versions. So you might try it and VS2015 with your code to see what happens.

HTH
Regards
TK


On 2016-03-26 08:20, mp.3333@... [DynoMotion] wrote:
> Hi Tom, the KFLOP is running well for most of my G code files. But > when trying to run large files (12K lines) with arcs made up of small > segments, I get random buffer underflow errors. I am running latest > version - 4.33 and using the Dynomotion VB.net app but customized for > my machine. The errors do not occur when running this same G code file > from the KMotionCNC app. > > After running a few minutes, the vb.net screen updates appear to slow > until the error is generated. I use the same 100msec timer to update > the screen. Could this rate be a problem with script commands? Any > thoughts on solution? > > Here are defaults: > > _Controller.CoordMotion.MotionParams.BreakAngle = 40 > > _Controller.CoordMotion.MotionParams.CollinearTolerance = 0.001 > > _Controller.CoordMotion.MotionParams.CornerTolerance = 0.001 > > _Controller.CoordMotion.MotionParams.FacetAngle = 1.0 > > _Controller.CoordMotion.MotionParams.MaxLinearLength = 100 > > _Controller.CoordMotion.MotionParams.TPLookahead = 3.0 > > Thanks, Mike > > > > -------------------------
Group: DynoMotion Message: 12994 From: mp.3333 Date: 3/27/2016
Subject: Re: Buffer Underflow Error

Hi Tom, I will try the new version and test.  But I tried to be careful and keep the existing VB example structure in place and only add a few data items that I needed. 


Thanks, Mike

Group: DynoMotion Message: 12997 From: Tom Kerekes Date: 3/27/2016
Subject: Re: Buffer Underflow Error
Hi Mike,

Oh I didn't realize you only made a few changes.  If possible please check if the problem exists in the original VB Example before making your changes.

Regards
TK


On 3/27/2016 12:51 PM, mp.3333@... [DynoMotion] wrote:
 

Hi Tom, I will try the new version and test.  But I tried to be careful and keep the existing VB example structure in place and only add a few data items that I needed. 


Thanks, Mike


Group: DynoMotion Message: 13002 From: mp.3333 Date: 3/27/2016
Subject: Re: Buffer Underflow Error

Hi Tom, I loaded VS2015 and the new version.  It performs the same.  The large g code file runs clean when using KMotionCNC...position and speed updates are very fast and no errors.  The files takes 7.25 minutes to run.  However, when I run it in the Dynomotion VB.net example, the screen updates are fast to start but slows down dramatically as the file runs and eventually errors on buffer underflow.


I used the example....just updated the scaling parameters.


Thanks, Mike

Group: DynoMotion Message: 13015 From: mp.3333 Date: 3/30/2016
Subject: Re: Buffer Underflow Error

Hi Tom, were you able to simulate the problem running a large g code file on the DynoMotion VB.net example?  I need to find a solution for this.


Please advise.


Thanks, Mike

Group: DynoMotion Message: 13018 From: Tom Kerekes Date: 3/30/2016
Subject: Re: Buffer Underflow Error
Hi Mike,

I wasn't able to duplicate the problem but that might be because I have a faster computer.  I do see the GUI update rate slowing.  I think the reason is the accumulation of the huge number of status messages displayed in those two GUI text boxes.  Each timer tick all those messages are removed, more accumulated, and reloaded to the GUI textbox.

I changed the example to just display the last 100 messages.  See this link to two files with the changes.
http://dynomotion.com/Software/Patch/DynomotionVB.NET_LimitDisplayOfStstusMessages/

Please merge in these changes and see if it solves the problem.

With the latest settings you sent both KMotionCNC and the VB Example seem to run the file you sent in ~11 minutes.  I'm not sure how you were getting 7 minutes.  Was that with those settings?

Regards
TK




On 3/30/2016 6:20 AM, mp.3333@... [DynoMotion] wrote:
 

Hi Tom, were you able to simulate the problem running a large g code file on the DynoMotion VB.net example?  I need to find a solution for this.


Please advise.


Thanks, Mike


Group: DynoMotion Message: 13020 From: mp.3333 Date: 3/30/2016
Subject: Re: Buffer Underflow Error

Hi Tom, I had already deleted the lblCoorStatus box from the form so was only updating the lblInterpreterFeedBack box.  To test I just deleted the call to update the status because it really is not needed...and that definitely helped.  Also, the corner tolerance and facet angle seem to factor into whether the buffer error triggers.


I will keep testing.  Do you think the PC may be an issue?  I just don't want to be on the edge.


I did recheck my KMotionCNC settings and I had them higher which resulted in 7 min runtime.  I set the MaxVel=10 and MaxAccel=80, and this resulted in about 10.5 mins for both.


Thanks, Mike



Group: DynoMotion Message: 13023 From: Tom Kerekes Date: 3/30/2016
Subject: Re: Buffer Underflow Error
Hi Mike,

The PC is not likely to be the problem if it runs Window reasonably well.

Regards
TK

On 3/30/2016 3:07 PM, mp.3333@... [DynoMotion] wrote:
 

Hi Tom, I had already deleted the lblCoorStatus box from the form so was only updating the lblInterpreterFeedBack box.  To test I just deleted the call to update the status because it really is not needed...and that definitely helped.  Also, the corner tolerance and facet angle seem to factor into whether the buffer error triggers.


I will keep testing.  Do you think the PC may be an issue?  I just don't want to be on the edge.


I did recheck my KMotionCNC settings and I had them higher which resulted in 7 min runtime.  I set the MaxVel=10 and MaxAccel=80, and this resulted in about 10.5 mins for both.


Thanks, Mike




Group: DynoMotion Message: 13044 From: mp.3333 Date: 4/2/2016
Subject: Re: Buffer Underflow Error

Hi Tom, I conducted more testing.  I do get better performance by deleting the 2 status boxes.  However, I still have odd issues when running that same file repeatedly.  In general, here is what happens...and I have tried adding a FlushBuf before running and inhibiting most all GUI updates.  I am monitoring ExecTime and RealtimeLine

Run    ExecTime    Actual Runtime   Delayed Start(RealtimeLine)

1         10:23              10:23                 About a sec to load 500 lines

2         10:23              10:33                 About 10 secs to load 500 lines         

3         10:23              11:20                 About 20 secs to load 500 lines         

4         10:23       Underflow Error       About 30 secs to load 500 lines         


If I disable corner rounding, it runs consistent on all 4 runs...about a sec to start and actual runtime is 10:12.


I would like to use corner rounding.  Do you have any thoughts on what this might be?


Thanks, Mike 

Group: DynoMotion Message: 13045 From: Tom Kerekes Date: 4/2/2016
Subject: Re: Buffer Underflow Error
Hi Mike,

I'm not able to replicate this.  When you say that you deleted the 2 status boxes what did you do exactly?  The code below accumulates the callback status until it can be added into a textbox by the GUI.  If it is never removed and displayed then it will accumulate into a huge string that needs to be constantly recreated.  If you don't intend to display the status then discard it rather than accumulating it.

Regards
TK


    Private Sub InterpreterStatusUpdated(ByVal lineno As Integer, ByVal msg As String)
        msg = msg.Replace(vbCr & vbCrLf, vbCrLf) ' get rid of redundant CR
        MessageMutex.WaitOne()
        _InterpreterStatus &= String.Format("[Interp Stat]  Line = {0} Data = {1}", lineno, msg)
        MessageMutex.ReleaseMutex()
    End Sub


On 4/2/2016 7:42 AM, mp.3333@... [DynoMotion] wrote:
 

Hi Tom, I conducted more testing.  I do get better performance by deleting the 2 status boxes.  However, I still have odd issues when running that same file repeatedly.  In general, here is what happens...and I have tried adding a FlushBuf before running and inhibiting most all GUI updates.  I am monitoring ExecTime and RealtimeLine

Run    ExecTime    Actual Runtime   Delayed Start(RealtimeLine)

1         10:23              10:23                 About a sec to load 500 lines

2         10:23              10:33                 About 10 secs to load 500 lines         

3         10:23              11:20                 About 20 secs to load 500 lines         

4         10:23       Underflow Error       About 30 secs to load 500 lines         


If I disable corner rounding, it runs consistent on all 4 runs...about a sec to start and actual runtime is 10:12.


I would like to use corner rounding.  Do you have any thoughts on what this might be?


Thanks, Mike 


Group: DynoMotion Message: 13062 From: mp.3333 Date: 4/4/2016
Subject: Re: Buffer Underflow Error

Hi Tom, I am back testing today.  I think I misunderstood how the status updates worked.  I was trying to remove unused tasks to speed things up and just commented around the block of code for textbox updates.  But now understand that I need to clear the status string whether I use it or not.  Initial tests looks good.


Thanks for your support.

Mike